<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>文件上传</title>
</head>
<body>
  <form action="/portrait" method="post" enctype="multipart/form-data">
    <div>
      用户名: <input type="text" name="username">
    </div>
    <div>
      头像: <input type="file" name="filename">
    </div>
    <button>上传</button>
  </form>
</body>

<script>
  let f = null
  function onFileChange(file) {
    console.log('file', file);
    
  }
  function upload() {
    console.log('点击上传');
    
  }
</script>
</html>